package com.ruoyi.web.controller.system;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.StatisticsQuery;
import com.ruoyi.system.service.IStatisticsQueryService;

import java.util.HashMap;
import java.util.Map;

/**
 * 统计查询Controller
 * 
 * @author coderChen
 * @date 2024-01-10
 */
@RestController
@RequestMapping("/system/statistics")
public class StatisticsQueryController extends BaseController
{
    @Autowired
    private IStatisticsQueryService statisticsQueryService;
    /**
     * 获取统计信息
     */
    @GetMapping
    public AjaxResult getStatistics()
    {
        int serviceCount = statisticsQueryService.getServiceCount();
        int educationCount = statisticsQueryService.getEducationCount();
        int classroomCount = statisticsQueryService.getClassroomCount();

        Map<String, Integer> data = new HashMap<>();
        data.put("serviceCount", serviceCount);
        data.put("educationCount", educationCount);
        data.put("classroomCount", classroomCount);
        System.out.println(data);

        return AjaxResult.success(data);

//        return  new AjaxResult("200,操作成功",data);
    }
//    @GetMapping
//    public AjaxResult getStatistics()
//    {
//        int serviceCount = statisticsQueryService.getServiceCount();
//        int educationCount = statisticsQueryService.getEducationCount();
//        int classroomCount = statisticsQueryService.getClassroomCount();
//
//        Map<String, Integer> resultMap = new HashMap<>();
//        resultMap.put("serviceCount", serviceCount);
//        resultMap.put("educationCount", educationCount);
//        resultMap.put("classroomCount", classroomCount);
//
//        return AjaxResult.success(resultMap);
//    }

}
